Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls


Public Partial Class User_Edit
        Inherits System.Web.UI.Page
	
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

        Dim UserName As String = Page.User.Identity.Name
        Dim UserAccount As MembershipUser = Membership.GetUser(UserName)
        Dim UserProfile As ProfileCommon = Profile.GetProfile(UserName)

        If (Not Page.IsPostBack) Then
            'Fill Membership Information
            uname.Text = UserAccount.UserName
            email.Text = UserAccount.Email

            lname.Text = UserProfile.LastName
            fname.Text = UserProfile.FirstName
            empid.Text = UserProfile.EmpId


        End If


    End Sub
    
    Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click

        Dim UserName As String = Page.User.Identity.Name
        Dim UserAccount As MembershipUser = Membership.GetUser(UserName)
        Dim UserProfile As ProfileCommon = Profile.GetProfile(UserName)

        'Save the User Account info
        UserAccount.Email = email.Text

        'Save the Profile info
        UserProfile.LastName = lname.Text
        UserProfile.FirstName = fname.Text
        UserProfile.EmpId = empid.Text
        UserProfile.Save()

        Response.Redirect("TimeEntry.aspx")

    End Sub

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        Response.Redirect("TimeEntry.aspx")

    End Sub
End Class
